IF exists(SELECT * FROM dbo.sysobjects WHERE name='seminarieExamenlokalen' AND xtype='V') 
BEGIN
	DROP VIEW seminarieExamenlokalen
END
GO

CREATE view seminarieExamenlokalen
as
select e.lokaal,s.groepscode,
	isnull(l.voornaam,'') + ' ' + isNull(l.achternaam,'') 
			+ ' (' + isnull(l.klas,'') + ')' as volleNaam
     from seminariegroepen as s
	left join leerlingen as l
	  on l.inschrijvingsNr = s.inschrijvingsNr
	left join seminarieExamen as e
	  on l.klas = e.klas and l.klasNr between e.beginNr and e.eindNr